package j02neicun;

public class J2string {
    public static void main(String[] args) {
        String s1 = "abc";
        String s2 = "abc";
        System.out.println(s1==s2);//true

        //至少new的时候不会用常量池
        String s3 = new String("xyz");
        String s4 = new String("xyz");
        System.out.println(s3 == s4);//false

    }
}

class J3err{
    public static void main(String[] args) {
        char[] chs = {'a','b','c'};
        String str1 = new String(chs);
        chs[0] = 'm';
        System.out.println("str1 = " + str1);//abc


        String s1 = "xyz";
        s1 += "m";//xyzm
    }
}
